import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import { createPinia } from 'pinia';
const pinia = createPinia();
Vue.use(pinia);

Vue.use(ElementUI);

Vue.config.productionTip = false
// 配置 axios
Vue.prototype.$http = axios  // 修改内部的$http 为 axios
// 添加 Axios 的拦截器
axios.interceptors.request.use(config => {
  // 每次发送请求我们都携带token信息
  var token = sessionStorage.getItem('token')
  config.headers['Authorization'] = token // 请求头带上Token
  return config;
}, error => {
  return Promise.reject(error);
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
